<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>背景样式 | 拼命赶进度</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-ace/ace.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
    

        
    
    
    <link rel="next" href="./列表样式.html" />
    
    
    <link rel="prev" href="./段落样式.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="2.3.6"
        data-chapter-title="背景样式"
        data-filepath="背景样式.md"
        data-basepath="."
        data-revision="Sun Sep 03 2017 23:30:11 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="html.html">
            
                
                    <a href="./html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML5
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="常用元素.html">
            
                
                    <a href="./常用元素.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        常用元素
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="图片音频视频.html">
            
                
                    <a href="./图片音频视频.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        图片音频视频
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="列表及表格.html">
            
                
                    <a href="./列表及表格.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        列表及表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="表单form元素.html">
            
                
                    <a href="./表单form元素.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        表单form元素
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="CSS.html">
            
                
                    <a href="./CSS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="如何引入CSS.html">
            
                
                    <a href="./如何引入CSS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        如何引入CSS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="选择器.html">
            
                
                    <a href="./选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        选择器
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="通配选择符.html">
            
                
                    <a href="./通配选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.1.</b>
                        
                        通配选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="元素选择符.html">
            
                
                    <a href="./元素选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.2.</b>
                        
                        元素选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="id 及 class 选择符.html">
            
                
                    <a href="./id 及 class 选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.3.</b>
                        
                        id 及 class 选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="群组选择符.html">
            
                
                    <a href="./群组选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.4.</b>
                        
                        群组选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.5" data-path="关系选择符.html">
            
                
                    <a href="./关系选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.5.</b>
                        
                        关系选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.6" data-path="属性选择符.html">
            
                
                    <a href="./属性选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.6.</b>
                        
                        属性选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.7" data-path="伪类选择符.html">
            
                
                    <a href="./伪类选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.7.</b>
                        
                        伪类选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.8" data-path="伪对象选择符.html">
            
                
                    <a href="./伪对象选择符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.8.</b>
                        
                        伪对象选择符
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="CSS的常用样式.html">
            
                
                    <a href="./CSS的常用样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        CSS的常用样式
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="字体样式.html">
            
                
                    <a href="./字体样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="元素分类.html">
            
                
                    <a href="./元素分类.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.2.</b>
                        
                        元素样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="边框.html">
            
                
                    <a href="./边框.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.3.</b>
                        
                        边框样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="盒子模型.html">
            
                
                    <a href="./盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.4.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="段落样式.html">
            
                
                    <a href="./段落样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.5.</b>
                        
                        段落样式
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="2.3.6" data-path="背景样式.html">
            
                
                    <a href="./背景样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.6.</b>
                        
                        背景样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="列表样式.html">
            
                
                    <a href="./列表样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.7.</b>
                        
                        列表样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="变形样式.html">
            
                
                    <a href="./变形样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.8.</b>
                        
                        变形样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="过渡动画.html">
            
                
                    <a href="./过渡动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.9.</b>
                        
                        过渡动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="自定义动画.html">
            
                
                    <a href="./自定义动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.10.</b>
                        
                        自定义动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="布局.html">
            
                
                    <a href="./布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.11.</b>
                        
                        布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.12" data-path="视口.html">
            
                
                    <a href="./视口.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.12.</b>
                        
                        视口
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.13" data-path="CSS总结.html">
            
                
                    <a href="./CSS总结.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.13.</b>
                        
                        CSS总结
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="JavaScript.html">
            
                
                    <a href="./JavaScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        JavaScript
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >拼命赶进度</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x80CC;&#x666F;&#x6837;&#x5F0F;">&#x80CC;&#x666F;&#x6837;&#x5F0F;</h1>
<h2 id="&#x80CC;&#x666F;&#x989C;&#x8272;">&#x80CC;&#x666F;&#x989C;&#x8272;</h2>
<p><code>background-color : transparent (&#x900F;&#x660E;)| color</code></p>
<pre><code>body { background-color:#CCCCCC;}

h1 { background-color:#EDEDED;}
</code></pre><h4 id="&#x989C;&#x8272;&#x4E4B;rgba">&#x989C;&#x8272;&#x4E4B;RGBA</h4>
<p>RGB&#x662F;&#x4E00;&#x79CD;&#x8272;&#x5F69;&#x6807;&#x51C6;&#xFF0C;&#x662F;&#x7531;&#x7EA2;(R)&#x3001;&#x7EFF;(G)&#x3001;&#x84DD;(B)&#x7684;&#x53D8;&#x5316;&#x4EE5;&#x53CA;&#x76F8;&#x4E92;&#x53E0;&#x52A0;&#x6765;&#x5F97;&#x5230;&#x5404;&#x5F0F;&#x5404;&#x6837;&#x7684;
&#x989C;&#x8272;&#x3002;RGBA&#x662F;&#x5728;RGB&#x7684;&#x57FA;&#x7840;&#x4E0A;&#x589E;&#x52A0;&#x4E86;&#x63A7;&#x5236;alpha&#x900F;&#x660E;&#x5EA6;&#x7684;&#x53C2;&#x6570;&#x3002;</p>
<p>color&#xFF1A;rgba(R,G,B,A)&#x4EE5;&#x4E0A;R&#x3001;G&#x3001;B&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x6B63;&#x6574;&#x6570;&#x503C;&#x7684;&#x53D6;&#x503C;&#x8303;&#x56F4;&#x4E3A;&#xFF1A;0 - 255&#x3002;&#x767E;&#x5206;&#x6570;&#x503C;&#x7684;
&#x53D6;&#x503C;&#x8303;&#x56F4;&#x4E3A;&#xFF1A;0.0% - 100.0%&#x3002;&#x8D85;&#x51FA;&#x8303;&#x56F4;&#x7684;&#x6570;&#x503C;&#x5C06;&#x88AB;&#x622A;&#x81F3;&#x5176;&#x6700;&#x63A5;&#x8FD1;&#x7684;&#x53D6;&#x503C;&#x6781;&#x9650;&#x3002;&#x5E76;&#x975E;&#x6240;&#x6709;&#x6D4F;&#x89C8;
&#x5668;&#x90FD;&#x652F;&#x6301;&#x4F7F;&#x7528;&#x767E;&#x5206;&#x6570;&#x503C;&#x3002;A&#x4E3A;&#x900F;&#x660E;&#x5EA6;&#x53C2;&#x6570;&#xFF0C;&#x53D6;&#x503C;&#x5728;0~1&#x4E4B;&#x95F4;&#xFF0C;&#x4E0D;&#x53EF;&#x4E3A;&#x8D1F;&#x503C;&#x3002;</p>
<pre><code>border-color:rgba(255 , 0 , 0 , .7);

background-color:rgba( 100 , 120 , 60 , .5 );

border-color:rgba(255 , 0 , 0 , .7);
</code></pre><h6 id="&#x6E10;&#x53D8;&#x8272;&#x5F69;">&#x6E10;&#x53D8;&#x8272;&#x5F69;</h6>
<p>CSS3 Gradient &#x5206;&#x4E3A;&#x7EBF;&#x6027;&#x6E10;&#x53D8;(linear)&#x548C;&#x5F84;&#x5411;&#x6E10;&#x53D8;(radial)&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x89D2;&#x5EA6;</th>
<th>&#x82F1;&#x6587;</th>
<th>&#x4F5C;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td>0deg</td>
<td>to top</td>
<td>&#x4ECE;&#x4E0B;&#x5411;&#x4E0A;</td>
</tr>
<tr>
<td>90deg</td>
<td>to right</td>
<td>&#x4ECE;&#x5DE6;&#x5411;&#x53F3;</td>
</tr>
<tr>
<td>180deg</td>
<td>to bottom</td>
<td>&#x4ECE;&#x4E0A;&#x5411;&#x4E0B;</td>
</tr>
<tr>
<td>270deg</td>
<td>to left</td>
<td>&#x4ECE;&#x53F3;&#x5411;&#x5DE6;</td>
</tr>
<tr>
<td>-</td>
<td>to top left</td>
<td>&#x53F3;&#x4E0A;&#x89D2;&#x5411;&#x5DE6;&#x4E0B;&#x89D2;</td>
</tr>
<tr>
<td>-</td>
<td>to top right</td>
<td>&#x5DE6;&#x4E0A;&#x89D2;&#x5411;&#x53F3;&#x4E0B;&#x89D2;</td>
</tr>
</tbody>
</table>
<blockquote>
<p>&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x7701;&#x7565;&#x65F6;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;&#x201C;180deg&#x201D;&#xFF0C;&#x7B49;&#x540C;&#x4E8E;&#x201C;to bottom&#x201D;&#x3002;
&#x7B2C;&#x4E8C;&#x4E2A;&#x548C;&#x7B2C;&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x8868;&#x793A;&#x989C;&#x8272;&#x7684;&#x8D77;&#x59CB;&#x70B9;&#x548C;&#x7ED3;&#x675F;&#x70B9;&#xFF0C;&#x53EF;&#x4EE5;&#x6709;&#x591A;&#x4E2A;&#x989C;&#x8272;&#x503C;&#x3002;(&#x989C;&#x8272;&#x503C;&#x540E;&#x9762;&#x53EF;&#x4EE5;&#x8FFD;&#x52A0;&#x767E;&#x5206;&#x6BD4;&#xFF0C;&#x8868;&#x793A;&#x8FD9;&#x4E2A;&#x989C;&#x8272;&#x8981;&#x5360;&#x603B;&#x80CC;&#x666F;&#x989C;&#x8272;&#x9762;&#x79EF;&#x7684;&#x767E;&#x5206;&#x6BD4;)</p>
</blockquote>
<pre><code>background-image:linear-gradient(to left, red 30%,blue);
</code></pre><h2 id="&#x80CC;&#x666F;&#x56FE;&#x7247;">&#x80CC;&#x666F;&#x56FE;&#x7247;</h2>
<p><code>background-image : none | url ( url )</code></p>
<pre><code>body { background-image:url(images/bg.gif);}
</code></pre><h2 id="&#x80CC;&#x666F;&#x5E73;&#x94FA;&#x65B9;&#x5F0F;">&#x80CC;&#x666F;&#x5E73;&#x94FA;&#x65B9;&#x5F0F;</h2>
<p><code>background-repeat : repeat | no-repeat | repeat-x | repeat-y</code></p>
<pre><code>body { background-repeat:repeat-x;}
</code></pre><h2 id="&#x80CC;&#x666F;&#x5B9A;&#x4F4D;">&#x80CC;&#x666F;&#x5B9A;&#x4F4D;</h2>
<p><code>background-position : &#x5DE6;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;  &#x4E0A;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;</code></p>
<pre><code>body { background-position:left bottom;}

body { background-position:30% 20px;}
</code></pre><h2 id="&#x80CC;&#x666F;&#x539F;&#x70B9;">&#x80CC;&#x666F;&#x539F;&#x70B9;</h2>
<p><code>background-origin &#xFF1A; border-box | padding-box | content-box;</code></p>
<p>&#x8BBE;&#x7F6E;&#x5143;&#x7D20;&#x80CC;&#x666F;&#x56FE;&#x7247;&#x7684;&#x539F;&#x59CB;&#x8D77;&#x59CB;&#x4F4D;&#x7F6E;&#x3002;&#x5FC5;&#x987B;&#x4FDD;&#x8BC1;&#x80CC;&#x666F;&#x662F;background-repeat&#x4E3A;no-repeat
&#x6B64;&#x5C5E;&#x6027;&#x624D;&#x4F1A;&#x751F;&#x6548;&#x3002;</p>
<h2 id="&#x80CC;&#x666F;&#x7684;&#x663E;&#x793A;&#x533A;&#x57DF;">&#x80CC;&#x666F;&#x7684;&#x663E;&#x793A;&#x533A;&#x57DF;</h2>
<p><code>background-clip &#xFF1A; border-box | padding-box | content-box | text</code><br>&#x8BBE;&#x5B9A;&#x80CC;&#x666F;&#x56FE;&#x50CF;&#x5411;&#x5916;&#x88C1;&#x526A;&#x7684;&#x533A;&#x57DF;&#x3002;</p>
<h2 id="&#x80CC;&#x666F;&#x6837;&#x5F0F;&#x7F29;&#x5199;">&#x80CC;&#x666F;&#x6837;&#x5F0F;&#x7F29;&#x5199;</h2>
<p>&#x80CC;&#x666F;&#x6837;&#x5F0F;&#x591A;&#x4E2A;&#x5C5E;&#x6027;&#x7684;&#x7F29;&#x5199;
background: &#x80CC;&#x666F;&#x8272;  &#x80CC;&#x666F;&#x56FE;&#x7247;  &#x80CC;&#x666F;&#x5E73;&#x94FA;&#x65B9;&#x5F0F;  &#x80CC;&#x666F;&#x5B9A;&#x4F4D;</p>
<pre><code>&#x7F29;&#x5199;&#x524D;
body {
    background-color:# EDEDED;
    background-image:url(images/bg.png);
    background-repeat:no-repeat;
    background-position:50%  30px;
}

&#x7F29;&#x5199;&#x540E;&#xFF1A;    
body { background:#EDEDED url(images/bg.png) no-repeat 50% 30px;}
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./段落样式.html" class="navigation navigation-prev " aria-label="Previous page: 段落样式"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./列表样式.html" class="navigation navigation-next " aria-label="Next page: 列表样式"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-ace/ace/ace.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-ace/ace.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"ace":{},"mdinhtml":{},"highlight":{},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
